package com.why.basictype;

import com.why.utils.BaseConversionUtils;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author by xiaoTian
 * @date 2022/5/20.
 */
public class U8 {
    private long value;

    public U8(long value){
        this.value = value;
    }

    public static U8 read(InputStream inputStream){
        byte[] bytes = new byte[8];
        try {
            inputStream.read(bytes);
        } catch (IOException e) {
            e.printStackTrace();
        }
        long value = BaseConversionUtils.byte2long(bytes);
        return new U8(value);
    }

    public long getValue(){return this.value;}

    public String getHexValue(){
        return Long.toHexString(value);
    }
}
